#! /usr/bin/python

from networking.clientrequest import BasicRequestMap
from networking.datatrans import BlockNegoTrans
from socket import *
from transfile import *

__author__="ken"
__date__ ="$2009-2-4 15:22:03$"

def runClient():
    cs = socket(AF_INET, SOCK_STREAM)
    # server ip
    cs.connect(("127.0.0.1", 2010))
    
    # start
    '''
    srcfile = open("F:\\Downloads\\Software\\wxPython2.8-win32-docs-demos-2.8.9.1.exe", "rb")
    sendFile(srcfile, cs)
    srcfile.close()
    cs.close()
    '''
    #data = cs.recv(4)
    #print data
    trans = BlockNegoTrans(cs)
    data = trans.frecv()
    print data
    reqmap = BasicRequestMap()
    datereq = reqmap.getRequest("TIME")
    date = datereq.request(trans)
    print date
    cs.send("QUI")
    cs.close()

    #quitreq = reqmap.getRequest("QUIT")
    #print quitreq.request(trans)
    

    
    

if __name__ == "__main__":
    runClient()
    